import 'package:flutter/material.dart';
import 'package:flutter_application_2/widgets/common_image.dart';
import './data.dart';

class ItemWidget extends StatelessWidget {
  final InfoItem data;
  const ItemWidget(this.data, {Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        Navigator.pushNamed(context, data.navigateUri);
      },
      child: Container(
        padding: EdgeInsets.all(5.0),
        height: 100.0,
        child: Row(
          children: [
            CommonImage(
              data.imageUri,
              width: 120.0,
              height: 90.0,
            ),
            Padding(padding: EdgeInsets.all(5.0)),
            Expanded(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    alignment: Alignment.centerLeft,
                    child: Text(
                      data.title,
                      style: TextStyle(fontWeight: FontWeight.w600),
                    ),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(data.source),
                      Text(data.time),
                    ],
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
